//
// Created by 123 on 2025/1/13.
//
#include "iostream"
#include "vector"
#include "algorithm"

class MyPrint{
public:
    void operator()(int val){
        std::cout << val << " ";
    }
};

void test(){
    std::vector<int> v1;
    std::vector<int> v2;
    for (int i = 0; i < 10; ++i) {
        v1.push_back(i);
        v2.push_back(i+100);
    }
    std::cout << "changeBefore:" << std::endl;
    std::for_each(v1.begin(), v1.end(),MyPrint());
    std::cout << std::endl;
    std::for_each(v2.begin(), v2.end(),MyPrint());
    std::cout << std::endl;
    std::swap(v1,v2);
    std::cout << "afterChange:" << std::endl;
    std::for_each(v1.begin(), v1.end(),MyPrint());
    std::cout << std::endl;
    std::for_each(v2.begin(), v2.end(),MyPrint());
    std::cout << std::endl;
}

int main161(){
    test();
    return 0;
}